home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Ham⁄GPS / SoftKiss.src.1.8 Folder / SoftKiss.src.1.8 / core / sfk_core_private.h < prev    next >
Text File  |  1993-03-17  |  18KB  |  740 lines

  1. /*
  2.  * SoftKiss device handling code private interface
  3.  * for use by code inside the device driver.
  4.  * by Aaron Wohl / N3LIW (aw0g+@andrew.cmu.edu) jul 1990
  5.  * 6393 Penn Ave #303
  6.  * Pittsburgh PA, 15206
  7.  * work: (412)-268-5032
  8.  * home: (412)-731-6159
  9.  */
  10.  
  11. #pragma once
  12.  
  13. #define SFK_SOFTKISS
  14.  
  15. #ifdef CODECHECK
  16. #include "sfk_codecheck.h"
  17. #endif
  18.  
  19. #include "sfk_core_command.h"
  20. #include "dbo_stdio.h"
  21.  
  22. #include <string.h>
  23. #include <setjmp.h>
  24. #include <asm.h>
  25. #include "sfk_dyntext.h"
  26.  
  27. /*
  28.  * bits enabled with debug command
  29.  */
  30. #define    DBO_interupts    (1)
  31. #define DBO_serial        (2)
  32.  
  33. #define sfk_TICKS (1L)
  34. #define sfk_SECS  (60*sfk_TICKS)    /*one second is this many ticks*/
  35. #define sfk_MINS (60*sfk_SECS)
  36. #define sfk_HOURS (60*sfk_MINS)
  37.  
  38. #define sfk_imax(xx_arg1,xx_arg2) (((xx_arg1)>(xx_arg2))?(xx_arg1):(xx_arg2))
  39. #define sfk_imin(xx_arg1,xx_arg2) (((xx_arg1)<(xx_arg2))?(xx_arg1):(xx_arg2))
  40.  
  41. #define SFK_ASSERT(xx_bool,xx_err_msg) \
  42.     do { if(!(xx_bool)) sfk_assert_fail(xx_err_msg);} while(0)
  43.  
  44. /*
  45.  * used to keep codecheck happy when the end of a routine is never reached
  46.  * becuase prevous function call throws an error
  47.  */
  48. #ifdef CODECHECK
  49. #define SFK_NEVER_RETURN(xx_arg) return (xx_arg)
  50. #else
  51. #define SFK_NEVER_RETURN(xx_arg)
  52. #endif
  53.  
  54. /*
  55.  * fatal error
  56.  */
  57. void sfk_assert_fail(char *msg);
  58.  
  59. /*
  60.  * map a text number to it's resource index
  61.  */
  62. #define TEXT_NUM(xx_arg) (xx_arg)
  63.  
  64. #define SFK_TEXT(xx_num) sfk_map_text(TEXT_NUM(xx_num))
  65.  
  66. /*
  67.  * name of resource containing driver
  68.  */
  69. #define sfk_driver_resource "\pRawSoftKissDRVR"
  70.  
  71. /*
  72.  * mask the parity bit of a character
  73.  */
  74. #define sfk_MASK_PARITY(xx_arg) ((xx_arg)&0x7f)
  75.  
  76. /*
  77.  * localy define a procedure with a prototype
  78.  */
  79. #define sfk_LDEF(xx_arg) static xx_arg; static xx_arg
  80.  
  81. #define sfk_INTS_OFF 0x2600
  82.  
  83. #ifdef CODECHECK
  84. #define sfk_SCC_interupts_off
  85. #define sfk_SCC_interupts_on
  86. #else
  87. #define sfk_SCC_interupts_off \
  88.     asm { move sr,-(a7)    }    /*save current sr*/ \
  89.     asm { or #sfk_INTS_OFF,sr }    { /*turn off scc interupts*/
  90.  
  91. #define sfk_SCC_interupts_on asm {move (a7)+,sr} }
  92. #endif
  93.  
  94. /*
  95.  * value of each variable private per port
  96.  */
  97. struct sfk_value_R {
  98.     union {                /*assembler macro below assumes union is first*/
  99.         uint32 nm_ival;    /*value of integer/boolean vars*/
  100.         char *nm_sval;    /*value of string variables*/
  101.     }x;
  102.     char changed;        /*true if changed since last online*/
  103. };
  104. typedef struct sfk_value_R sfk_value,*sfk_value_pt;
  105.  
  106. #define sfk_CMD_NUM(xx_vnum) (sfk_cval_##xx_vnum)
  107. #define sfk_IVAR(xx_vnum) var_vals[sfk_CMD_NUM(xx_vnum)].x.nm_ival
  108.  
  109. /*
  110.  * same IVAR for use in assembler
  111.  */
  112. #define sfk_IVAR_ASM(xx_vnum) (OFFSET(sfk_prt,var_vals)+sfk_CMD_NUM(xx_vnum)*sizeof(sfk_value))
  113.  
  114. #define sfk_SVAR(xx_vnum) var_vals[sfk_CMD_NUM(xx_vnum)].x.nm_sval
  115. #define sfk_CHANGED(xx_vnum) var_vals[sfk_CMD_NUM(xx_vnum)].changed
  116.  
  117. /*
  118.  * a queue of packets
  119.  */
  120. struct sfk_queue_R {
  121.     sfk_packet_pt sfk_first;    /*first available packet or nil*/
  122.     sfk_packet_pt sfk_last;        /*last packet on queue or nil*/
  123.     uint32 sfk_size;            /*number of packets on queue*/
  124. };
  125. typedef struct sfk_queue_R sfk_queue,*sfk_queue_pt;
  126.  
  127. /*
  128.  * initialize the passed queue to be empty
  129.  */
  130. void sfk_init_queue(sfk_queue_pt aq);
  131.  
  132. /*
  133.  * enqueue the passed packet in the passed queue
  134.  */
  135. void sfk_enqueue(sfk_queue_pt aq,sfk_packet_pt ap);
  136.  
  137. /*
  138.  * remove a packet from the passed queue and return it
  139.  * returns nil if the queue was empty
  140.  */
  141. void sfk_enqueue_protected(sfk_queue_pt aq,sfk_packet_pt ap);
  142.  
  143. /*
  144.  * remove a packet from the passed queue and return it
  145.  * returns nil if the queue was empty
  146.  */
  147. sfk_packet_pt sfk_dequeue(sfk_queue_pt aq);
  148.  
  149. /*
  150.  * remove a packet from the passed queue and return it
  151.  * returns nil if the queue was empty
  152.  */
  153. sfk_packet_pt sfk_dequeue_protected(sfk_queue_pt aq);
  154.  
  155. /*
  156.  * number of write registers in a scc
  157.  * (more or less, there is this 7 prime register...)
  158.  */
  159. #define NUM_SCC_REGS (16)
  160.  
  161. /*
  162.  * port states
  163.  */
  164. enum px_states_e {
  165.     PX_OFF,            /*0 port offline*/
  166.     PX_RX,            /*1 RX mode*/
  167.     PX_RX_NOW,         /*2 RX of packet in progress*/
  168.     PX_RX_CHUCK,     /*3 RX but throw away data*/
  169.     PX_SLOT_WAIT,     /*4 waiting for dwait/slottime to expire*/
  170.     PX_KEY_UP,        /*5 keying up, sending flags*/
  171.     PX_XMIT,        /*6 transmiting*/
  172.     PX_TAIL            /*7 sending trailer*/
  173. };
  174. typedef enum px_states_e px_states;
  175.  
  176. #ifdef RUBBISH_THIS_STUFF_COMES_FROM_8530_H
  177. /*
  178.  * names for scc registers
  179.  */
  180. enum sfk_scc_reg_e {
  181.     R0,R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15
  182. };
  183. typedef enum sfk_scc_reg_e sfk_scc_reg;
  184. #endif
  185.  
  186. #define WANT_XMIT(xx_p) (xx_p->sfk_xmitq.sfk_size>0)
  187.  
  188. /*
  189.  * sfk_circular_buffer
  190.  */
  191. struct sfk_circular_buffer_R {
  192.     long cu_size;            /*size of buffer in characters*/
  193.     long cu_read;            /*removal pointer*/
  194.     long cu_write;            /*insertion pointer*/
  195.     char *cu_buf;            /*pointer to buffer*/
  196. };
  197. typedef struct sfk_circular_buffer_R sfk_circular_buffer,*sfk_circular_buffer_pt;
  198.  
  199. /*
  200.  * uninitialize a circular buffer, release any allocated space
  201.  */
  202. void sfk_cu_uninit(sfk_circular_buffer_pt cu);
  203.  
  204. /*
  205.  * initialize a curcular buffer
  206.  */
  207. void sfk_cu_init(sfk_circular_buffer_pt cu,long max_size);
  208.  
  209. /*
  210.  * write data
  211.  */
  212. long sfk_cu_write(sfk_circular_buffer_pt cu,char *put_me,long put_size);
  213.  
  214. /*
  215.  * return max number of bytes that can be written
  216.  */
  217. long sfk_cu_write_size(sfk_circular_buffer_pt cu);
  218.  
  219. /*
  220.  * return max number of bytes that can be read
  221.  */
  222. long sfk_cu_read_size(sfk_circular_buffer_pt cu);
  223.  
  224. /*
  225.  * read data
  226.  */
  227. long sfk_cu_read(sfk_circular_buffer_pt cu,char *read_me,long read_size);
  228.  
  229. /*
  230.  * read data stopping on break (control) characters
  231.  */
  232. long sfk_cu_read_line(sfk_circular_buffer_pt cu,char *read_me,long read_size);
  233.  
  234. /*
  235.  * data for each kiss port (AIn, AOut, BIn or BOut)
  236.  */
  237. struct kiss_port_R {
  238.     int                kp_state;    //read/write packet state
  239.     int                kp_offset;    //data transfer offset
  240.     int                kp_refnum;    //driver number
  241.     int                kp_is_in;    //true if input device
  242.     int                kp_transpose; //transpose next character
  243.     unsigned char    kp_cmd;        //incomming command byte
  244.     sfk_packet_pt     kp;            //currently packet being transfered
  245.     long             kp_old;        //old dce
  246.     unsigned char  *kp_name;    //name of driver
  247.     DCtlPtr         *kp_de;        //this ports dce dce
  248.     IOParam         *kp_pb;        //pending prime pb
  249.     //kiss_in/out or soft_tnc_in/out
  250.     short (*kp_io)(CntrlParam *pb,DCtlPtr de,short op,void *extra);
  251.     sfk_circular_buffer io_buf;    //text io buffer
  252. };
  253. typedef struct kiss_port_R kiss_port,*kiss_port_pt;
  254.  
  255. //output port states
  256. #define KRP_NP            0    //no packet, look for sync
  257. #define KRP_SYNC        1    //in sync
  258. #define KRP_WP            2    //write packet
  259. #define KRP_READ_CMD    3    //recieving command byte
  260.  
  261. //define number of kiss ports
  262. #define KISS_IN     (0)
  263. #define KISS_OUT     (1)
  264. #define NUM_KISS_PORTS (2)    //xin,xout
  265.  
  266. #define K_IN kports[KISS_IN]
  267. #define K_OUT kports[KISS_OUT]
  268.  
  269. /*
  270.  * port block can specify port a or b
  271.  */
  272. struct sfk_prt_R {
  273.     int             pnum;        /*port number of this port*/
  274.     px_states        sfk_state;    /*current port state*/
  275.     char             *port_name;    /*text name of this port*/
  276.     sfk_queue         sfk_freehq;    /*queue of free packets headers*/
  277.     sfk_queue         sfk_freedq;    /*queue of free data packets*/
  278.     sfk_queue         sfk_xmitq;    /*queue of outgoing packets*/
  279.     sfk_queue         sfk_recvq;    /*queue of incomming packets*/
  280.     sfk_packet_pt     sfk_in;        /*currently arriving packet*/
  281.     sfk_packet_pt     sfk_out;    /*currently outgoing packet*/
  282.     long in_count;                /*input packet size*/
  283.     long out_count;                /*bytes left to send*/
  284.     volatile uint8     *ctl_rd;    /*pointers to scc registers*/
  285.     volatile uint8     *ctl_wr;
  286.     volatile uint8     *data_rd;
  287.     volatile uint8     *data_wr;
  288.     sfk_value         var_vals[sfk_max_cmd_num]; /*per port variables*/
  289.     uint8             scc_reg_cache[NUM_SCC_REGS];
  290.     uint8             extra_tx_bits_for_line_power; /*leave these on even in rx*/
  291.     uint8            timer_installed;    //true if queue entry is installed
  292.     uint8            timer_ignore;        //if it goes off ignore it
  293.     TMTask            timer_task;        /*allow time for keup*/
  294.     void            (*low_level_timer_routine)(); /*call this when the timer goes off*/
  295.     void            (*timer_routine)(struct sfk_prt_R *p); /*call this when the timer goes off*/
  296. #ifdef DBO_ENABLED
  297.     dbo_FILE        dbo;            /*debugging output*/
  298.     int                dbo_optr;        /*output pointer for interupt line*/
  299. #endif
  300.     void (*pr_recv_int)(struct sfk_prt_R *p);
  301.     void (*pr_spcl_int)(struct sfk_prt_R *p);
  302.     void (*pr_extr_int)(struct sfk_prt_R *p);
  303.     int                cmd_port;
  304.     int                cmd_did_prompt;
  305.     int                cmd_buf_len;    /*length of command line*/
  306.     int                cmd_buf_limit;    /*max size of command buffer*/
  307.     char            *cmd_buf;        /*current input line in tnc mode*/
  308.     /*kiss variables*/
  309.     kiss_port        kports[NUM_KISS_PORTS];
  310. };
  311. typedef struct sfk_prt_R sfk_prt,*sfk_prt_pt;
  312.  
  313. #define sfk_SIZE_Lvl2     (8)        /*size of level 2 interupt table*/
  314. #define sfk_SIZE_Ext    (4)        /*size of External interupt table*/
  315.  
  316. /*
  317.  * private state for debugging
  318.  */
  319. struct sfk_priv_state_R {
  320.     sfk_prt skf_prt_table[sfk_NUM_PORTS];
  321.     long magicno;
  322.     /*while we have private interupt vectors save the system ones here*/
  323.     ProcPtr saved_lvl2[sfk_SIZE_Lvl2];
  324.     ProcPtr saved_ext[sfk_SIZE_Ext];
  325.     Handle driver_template;        /*template to create drivers on the fly*/
  326.     dyn_text dt_text;            /*dt text*/
  327.     char vers[16];                /*version text*/
  328. };
  329. typedef struct sfk_priv_state_R sfk_priv_state,*sfk_priv_state_pt;
  330.  
  331. #define sfk_PN(xx_n) (&sfk_gl.skf_prt_table[xx_n])
  332. #define sfk_PA sfk_PN(sfk_MODEM_PORT)
  333. #define sfk_PB sfk_PN(sfk_PRINTER_PORT)
  334.  
  335. void sfk_reset_scc(sfk_prt_pt p);
  336. void sfk_setup_scc(sfk_prt_pt p);
  337.  
  338. #define sfk_or_scc(xx_p,xx_rnum,xx_val) \
  339.     sfk_write_scc(xx_p,(xx_rnum),((xx_p->scc_reg_cache[(xx_rnum)])|(xx_val)))
  340.  
  341. #define sfk_cand_scc(xx_p,xx_rnum,xx_val) \
  342.     sfk_write_scc((xx_p),(xx_rnum),(((xx_p)->scc_reg_cache[(xx_rnum)])&(~(xx_val))))
  343.  
  344. #ifndef SCC_ASM_DEFS
  345. void sfk_write_scc_data(sfk_prt_pt p,uint8 val);
  346. uint8 sfk_read_scc_data(sfk_prt_pt p);
  347. void sfk_write_scc(sfk_prt_pt p,uint8 rnum,uint8 val);
  348. uint8 sfk_read_scc(sfk_prt_pt p,uint8 rnum);
  349. #endif
  350.  
  351. /*
  352.  * macro to declare that an argument is unused in a proceedure
  353.  */
  354. #ifdef CODECHECK
  355. void reference_used(void *)
  356. #define SFK_UNUSED_ARG(xx_arg) reference_used(&xx_arg)
  357. #else
  358. #define SFK_UNUSED_ARG(xx_arg)
  359. #endif
  360.  
  361. /*
  362.  * begin transmiting
  363.  * call with interupts off
  364.  */
  365. void sfk_initiate_xmit(sfk_prt_pt p);
  366.  
  367. /*
  368.  * reset highest interupt under service
  369.  */
  370. #define sfk_reset_scc_ius(xx_p) sfk_write_scc(xx_p,R0,RES_H_IUS)
  371.  
  372. /*
  373.  * error returns from control routine
  374.  */
  375. #define sfk_MMCE_bad_maj    -1000    /*major version in set packet doesn't match driver*/
  376. #define sfk_MMCE_noopen        -1001    /*driver wasn't properly opened*/
  377.  
  378. #define sfk_MIN_REMIND sfk_imax(((sfk_gl.cps.server_poll)+1*sfk_MINS+10*sfk_SECS),sfk_ABS_MIN_POLL)
  379.  
  380. void sfk_install_interupt_vectors(sfk_prt_pt p);
  381. void sfk_remove_interupt_vectors(sfk_prt_pt p);
  382.  
  383. #ifndef sfk_CORE_EXTERN
  384. #define sfk_CORE_EXTERN extern
  385. #endif
  386. sfk_CORE_EXTERN sfk_priv_state sfk_gl;
  387.  
  388. /*
  389.  * delay between scc accesses where an increment of a 32bit unsigned
  390.  * long is also done between accesses
  391.  */
  392. #define sfk_SCC_COUNT_DELAY
  393.  
  394. /*
  395.  * parse state
  396.  */
  397. #define sfk_MAX_TOKEN (260)
  398. struct sfk_parse_rec_R {
  399.     sfk_prt_pt p;
  400.     char ch;        /*current character*/
  401.     int eof;
  402. };
  403. typedef struct sfk_parse_rec_R sfk_parse_rec,*sfk_parse_rec_pt;
  404.  
  405. /*
  406.  * internal io record
  407.  * contains user io record, error throw
  408.  * and per call globals so driver is reentrant
  409.  */
  410. struct sfk_iio_R {
  411.     sfk_io_record_pt uio;    /*users io record*/
  412.     jmp_buf err_throw;        /*throw errors to here to exit control call*/
  413.     /*per command per control call variables*/
  414.     sfk_parse_rec pqx;        /*parse state*/
  415. };
  416. typedef struct sfk_iio_R sfk_iio,*sfk_iio_pt;
  417.  
  418. /*
  419.  * a control call to the us has failed
  420.  * unwind the stack and return the error
  421.  */
  422. void sfk_control_fail(sfk_iio_pt iicmd,short io_err,short iio_err);
  423.  
  424. /*
  425.  * initilize the command table
  426.  */
  427. void sfk_init_commands(sfk_iio_pt cmd);
  428.  
  429. /*
  430.  * parse and execute the passed command
  431.  */
  432. void sfk_parse_command(sfk_iio_pt cmd);
  433.  
  434. /*
  435.  * read a packet from recieve queues
  436.  */
  437. void sfk_read(sfk_iio_pt cmd);
  438.  
  439. /*
  440.  * enqueue a packet in a write queue
  441.  */
  442. void sfk_write(sfk_iio_pt cmd);
  443.  
  444. /*
  445.  * append a c string onto the end of a sfk_string
  446.  * don't overflow the output string
  447.  */
  448. void sfk_put_string(sfk_string_pt astr,char *add_on);
  449.  
  450. /*
  451.  * handle control calls to the driver
  452.  */
  453. int sfk_control(sfk_io_record_pt pb);
  454.  
  455. /*
  456.  * handle open calls to the driver
  457.  */
  458. int sfk_init(void);
  459.  
  460. /*
  461.  * handle close calls to the driver
  462.  */
  463. int sfk_uninit(sfk_io_record_pt pb);
  464.  
  465. /*
  466.  * perform periodic actions
  467.  */
  468. void sfk_tick(sfk_iio_pt cmd);
  469.  
  470. /*
  471.  * append a string onto command output
  472.  */
  473. void sfk_cmd_out(sfk_iio_pt cmd,char *add_on);
  474.  
  475. /*
  476.  * go online or go offline
  477.  */
  478. void sfk_change_online(sfk_iio_pt cmd,int new_setting);
  479.  
  480. /*
  481.  * map a failure code to it's text
  482.  */
  483. char *sfk_map_text(int text_code);
  484.  
  485. /*
  486.  * report a command failure
  487.  */
  488. void sfk_parse_fail(sfk_iio_pt cmd,int fail_code,char *extra);
  489.  
  490. /*
  491.  * patch each interupt routine to known where our data lives
  492.  */
  493. void sfk_patch_in_global_data(void);
  494.  
  495. /*
  496.  * some macs have a data and code cache that needs to be flushed
  497.  * after patching code
  498.  */
  499. void sfk_some_flush(void);
  500.  
  501. /*
  502.  * setup pointers to registers
  503.  */
  504. void sfk_init_register_addresses(sfk_prt_pt p);
  505.  
  506. /*
  507.  * set divider for proper rate to transmit
  508.  * need to wait one underflow to pick up proper rate
  509.  */
  510. void sfk_scc_set_buad_divider_xmit(sfk_prt_pt p);
  511.  
  512. /*
  513.  * set divider for proper rate to recieve
  514.  * need to wait one underflow to pick up proper rate
  515.  */
  516. void sfk_scc_set_buad_divider_recv(sfk_prt_pt p);
  517.  
  518. /*
  519.  * shutdown everything
  520.  */
  521. void sfk_shutdown(sfk_iio_pt cmd);
  522.  
  523. /*
  524.  * handle a transition to a new state
  525.  */
  526. void sfk_go_state(sfk_prt_pt p,px_states new_state);
  527.  
  528. /*
  529.  * set interupts and buad rate for recieve mode
  530.  */
  531. void sfk_set_recv_mode(sfk_prt_pt p);
  532.  
  533. /*
  534.  * transition to actually recieving a packet
  535.  */
  536. void sfk_set_recv_now_mode(sfk_prt_pt p);
  537.  
  538. /*
  539.  * transition to actually recieve packet but throw away data
  540.  */
  541. void sfk_set_recv_chuck_mode(sfk_prt_pt p);
  542.  
  543. /*
  544.  * keyup and schedule start of transmit
  545.  */
  546. void sfk_keyup(sfk_prt_pt p,long delay_time);
  547.  
  548. /*
  549.  * put scc in xmit mode and schedule transmit
  550.  */
  551. void sfk_tell_scc_to_xmit(sfk_prt_pt p);
  552.  
  553. /*
  554.  * end of keyup time so clear keyup timer
  555.  */
  556. void sfk_clear_timer(sfk_prt_pt p);
  557.  
  558. /*
  559.  * force keydown
  560.  */
  561. void sfk_keydown(sfk_prt_pt p);
  562.  
  563. /*
  564.  * set the timer to call to the specified routine after delay
  565.  * delay is in milliseconds if posative or microseconds if negative
  566.  */
  567. void sfk_install_timer(sfk_prt_pt p,void (*rtn)(sfk_prt_pt p),long delay);
  568.  
  569. /*
  570.  * start transmiting
  571.  */
  572. void sfk_send_first_byte(sfk_prt_pt p);
  573.  
  574. /*
  575.  * set state to allow crc/sync char to go out
  576.  */
  577. void sfk_tail(sfk_prt_pt p);
  578.  
  579. /*
  580.  * prepare the sfk_in packet to be ready to start recieving
  581.  */
  582. void sfk_prep_rx(sfk_prt_pt);
  583.  
  584. /*
  585.  * change kiss mode to on or off
  586.  */
  587. void sfk_change_kiss(sfk_iio_pt cmd,int new_setting);
  588.  
  589. /*
  590.  * turn off kiss mode on the passed port
  591.  */
  592. void sfk_change_soft_tnc(sfk_iio_pt cmd,int new_setting);
  593.  
  594. /*
  595.  * mark the waiting iopb as finished
  596.  */
  597. void sfk_mark_read_done(sfk_prt_pt p,int er_code);
  598.  
  599. /*
  600.  * queue up a packet for write and start transmit if it isn't
  601.  * already running
  602.  */
  603. void sfk_enqueue_write(sfk_prt_pt p,sfk_packet_pt pak);
  604.  
  605. /*
  606.  * kiss_note_offline - tell kiss that the port went offline
  607.  */
  608. void kiss_note_offline(sfk_prt_pt p);
  609.  
  610. /*
  611.  * entry point of softkiss packet driver
  612.  * This entry is for softkiss itself.
  613.  * The fake serial entrypoints are in sfk_core_kiss.c
  614.  */
  615. short sfk_driver(CntrlParam *pb,DCtlPtr de,short op,void *extra);
  616.  
  617. /*
  618.  * find the softkiss driver
  619.  * if it is not present, install it
  620.  */
  621. short sfk_drvr_find_or_install(short *ref_num);
  622.  
  623. /*
  624.  * see if eithor serial port is in use
  625.  */
  626. int is_serial_busy(sfk_prt_pt p);
  627.  
  628. /*
  629.  * install one driver, kiss_in or kiss_out
  630.  */
  631. void sfk_fake_serial_install(
  632.     sfk_iio_pt cmd,
  633.     sfk_prt_pt p,
  634.     kiss_port_pt k_in,
  635.     long entry_point_in,
  636.     kiss_port_pt k_out,
  637.     long entry_point_out);
  638.  
  639.  
  640. /*
  641.  * enable the fake serial drivers
  642.  */
  643. void fake_serial_on(sfk_iio_pt cmd,sfk_prt_pt p);
  644.  
  645. /*
  646.  * turn off kiss mode on the passed port
  647.  */
  648. void fake_serial_off(sfk_prt_pt p);
  649.  
  650. /*
  651.  * install soft_tnc as the current fake serial driver
  652.  */
  653. void sfk_soft_tnc_install(sfk_iio_pt cmd,sfk_prt_pt p);
  654.  
  655. /*
  656.  * name of driver,ie pass this to OpenDriver
  657.  */
  658. #define sfk_driver_name "\p.ax25_packet"
  659.  
  660. /*
  661.  * allocate some memory
  662.  */
  663. void *sfk_malloc(unsigned long msize);
  664.  
  665. /*
  666.  * free some memory
  667.  */
  668. void sfk_free(void *buf);
  669.  
  670. /*
  671.  * allocate the storage that will become the packet queues
  672.  */
  673. void sfk_allocate_queue_memory(sfk_iio_pt cmd,sfk_prt_pt p);
  674.  
  675. /*
  676.  * allocate memory for soft_tnc
  677.  */
  678. void sfk_allocate_soft_tnc_memory(sfk_iio_pt cmd,sfk_prt_pt p);
  679.  
  680. /*
  681.  * allocate a packet header and packet
  682.  */
  683. sfk_packet_pt sfk_allocate_packet(sfk_prt_pt p);
  684.  
  685. /*
  686.  * allocate a packet header and packet
  687.  * may be called with interupts on
  688.  */
  689. sfk_packet_pt sfk_allocate_protected(sfk_prt_pt p);
  690.  
  691. /*
  692.  * free a packet header and packet
  693.  */
  694. void sfk_free_packet(sfk_prt_pt p,sfk_packet_pt free_me);
  695.  
  696. /*
  697.  * free a packet header and packet
  698.  * may be called with interupts on
  699.  */
  700. void sfk_free_packet_protected(sfk_prt_pt p,sfk_packet_pt free_me);
  701.  
  702. /*
  703.  * copy a packet header and share a packet
  704.  */
  705. sfk_packet_pt sfk_copy_packet(sfk_prt_pt p,sfk_packet_pt copy_me);
  706.  
  707. /*
  708.  * mark this driver as being open
  709.  * fail if it is already open
  710.  */
  711. int sfk_open_me(DCtlPtr de);
  712.  
  713. /*
  714.  * mark this driver as being closed
  715.  */
  716. void sfk_close_me(DCtlPtr de);
  717.  
  718. /*
  719.  * recompute values that depend on other variables
  720.  */
  721. void sfk_recompute_derived_nums(sfk_prt_pt p);
  722.  
  723. /*
  724.  * set the interface offline
  725.  */
  726. void sfk_go_offline(sfk_prt_pt p);
  727.  
  728. /*
  729.  * return command table entry to dump to resource fork
  730.  * used in test program
  731.  */
  732. int sfk_cmd_dump(int idx,char **nm_text,char **nm_help,
  733.     char **nm_default,long *nm_flags,short *nm_val_num);
  734.  
  735. /*
  736.  * is one time startup init done
  737.  */
  738. int sfk_init_done(void);
  739.  
  740.